using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace System.IPod
{
	static class StructUtil
	{
		public static byte[] GetBytes(object valueType)
		{
			int size = Marshal.SizeOf(valueType);
			IntPtr ptr = Marshal.AllocHGlobal(size);
			Marshal.StructureToPtr(valueType, ptr, false);
			byte[] data = new byte[size];
			Marshal.Copy(ptr, data, 0, size);
			Marshal.FreeHGlobal(ptr);

			return data;
		}
	}
}
